# -*- coding: utf-8 -*-
from __future__ import unicode_literals

import os

import django
from django.test import TestCase

# Create your tests here.

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'EDM.settings')  # 在Django 里想单独执行文件写上这句话
django.setup()  # 执行


# from views import clean_edm_tasks_cache,import_edm_tasks_cache,import_edm_tasks


if __name__ == '__main__':
    # clean_edm_tasks_cache()
    # secc_lines, err_lines = import_edm_tasks_cache("123456")
    # import_edm_tasks()
    # # err_lines = inport_edm_tasks_cache()
    # print secc_lines
    # print err_lines

    def generate_acount(randomlength):
        '''创建10000用户'''

        import random
        import string

        str_list = random.sample(string.ascii_uppercase, 1)
        str_list_2 = random.sample(string.lowercase, randomlength - 1)
        str_list.extend(str_list_2)
        random_str = ''.join(str_list)
        acount = random_str + '@josephrobinettebiden.top'

        json_dict = {
            'username': acount,
            'password': '6bbe10b4980cabb5d6e2cac1668b05db',
            'realname': random_str,
        }
        url_create_acount = url_base + 'api/v1/mailbox/'
        headers = {
            'Authorization': 'JWT ' + get_token(),
        }
        res_dict = requests.post(url_create_acount, headers=headers, json=json_dict).json()
        print res_dict